<admintpl file="header" />
</head>
<body>
	<div class="wrap js-check-wrap">
		<ul class="nav nav-tabs">
			<li class="active"><a href="javascript:;">公告管理</a></li>
			<li><a href="{:U('News/add',array('term'=>empty($term['term_id'])?'':$term['term_id']))}" target="_self">添加公告</a></li>
		</ul>
		<form class="well form-search" method="post" action="{:U('News/index')}">
			<table class="table table-hover table-bordered" style="height:50px">
				<tr>
					<td>主标题：
						<input type="text" name="subject" style="width: 200px;" value="{:I('request.subject')}" placeholder="请输入主标题">
					</td>
					<td>
					发布时间：
					<input type="text" name="start_time" class="js-datetime" value="{$start_time|default=''}" style="width: 120px;" autocomplete="off">-
					<input type="text" class="js-datetime" name="end_time" value="{$end_time|default=''}" style="width: 120px;" autocomplete="off"> &nbsp; &nbsp;
				</td>
				</tr>
				<tr>
					<td>类别： 
						<select name="classid">
							<option value='0' <php>if($classid == 0) echo "selected"</php>>-全部-</option>
							<option value="2" <php>if($classid == 2) echo "selected"</php>>玩家公告</option>
							<option value="3" <php>if($classid == 3) echo "selected"</php>>玩家信息</option>
							<option value="4" <php>if($classid == 4) echo "selected"</php>>代理公告</option>
						</select> &nbsp;&nbsp;
					</td>
					<td>发布状态: 
						<select name="islock" id="">
							<option value="" <php>if($islock == "") echo "selected"</php>>-全部-</option>
							<option value="0" <php>if($islock == "0") echo "selected"</php>>锁定</option>
							<option value="1" <php>if($islock == 1) echo "selected"</php>>发布</option>
						</select>
					</td>
				</tr>
				<tr>
					<td colspan='2'>
						<input type="submit" class="btn btn-primary" value="搜索" />
						<a class="btn btn-danger" href="{:U('News/index')}">清空</a>
					</td>
				</tr>
			</table>
		</form>
		<form class="js-ajax-form" action="" method="post">
			<div class="table-actions">
				<notempty name="term">
				<button class="btn btn-primary btn-small js-ajax-submit" type="submit" data-action="{:U('News/listorders')}">{:L('SORT')}</button>
				</notempty>
				<button class="btn btn-primary btn-small js-ajax-submit" type="submit" data-action="{:U('News/check',array('IsLock'=>1))}" data-subcheck="true">发布</button>
				<button class="btn btn-primary btn-small js-ajax-submit" type="submit" data-action="{:U('News/check',array('IsLock'=>0))}" data-subcheck="true">锁定</button>
				<button class="btn btn-danger btn-small js-ajax-submit" type="submit" data-action="{:U('News/delete')}" data-subcheck="true" data-msg="您确定删除吗？">{:L('DELETE')}</button>
			</div>
			<table class="table table-hover table-bordered table-list">
				<thead>
					<tr>
						<th width="15"><label><input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x"></label></th>
						<notempty name="term">
						<th width="50">{:L('SORT')}</th>
						</notempty>
						<th width="50">ID</th>
						<th width="300">主标题</th>
						<th width="50">作者</th>
						<th width="50">类别</th>
						<!-- <th width="50">缩略图</th> -->
						<th width="100">发布时间</th>
						<th width="50">状态</th>
						<th width="70">{:L('ACTIONS')}</th>
					</tr>
				</thead>
				<foreach name="news" item="vo">
				<tr>
					<td><input type="checkbox" class="js-check" data-yid="js-check-y" data-xid="js-check-x" name="ids[]" value="{$vo.newsid}" title="ID:{$vo.newsid}"></td>
                    <td><b>{$vo.newsid}</b></td>
					<td>{$vo.subject}</td>
					<td>{$vo.user_login}</td>
					<td>
						<php>
							if($vo['classid'] =='2'){
								echo "玩家公告";
							}elseif($vo['classid'] =='3'){
								echo "玩家信息";
							}elseif($vo['classid'] =='4'){
								echo "代理公告";
							}
						</php>
					</td>
					<!-- <td>
						<php>$smeta=$vo['thumb'];</php>
							<a href="javascript:parent.image_preview_dialog('{:sp_get_image_preview_url($smeta)}');">
								<i class="fa fa-photo fa-fw"></i>
							</a>
					</td> -->
					<td>{:date('Y-m-d H:i',strtotime($vo['issuedate']))}</td>
					<td>
						<notempty name="vo.islock">
							<a data-toggle="tooltip" title="发布">发布</a>
							<else/>
							<a data-toggle="tooltip" title="锁定" style="color:red">锁定</a>
						</notempty>
					</td>
					<td>
						<a href="{:U('News/edit',array('id'=>$vo['newsid']))}">{:L('EDIT')}</a> | 
						<a href="{:U('News/delete',array('id'=>$vo['newsid']))}" class="js-ajax-delete">{:L('DELETE')}</a>
					</td>
				</tr>
				</foreach>
			</table>
			<div class="pagination">{$page}</div>
		</form>
	</div>
	<script src="__PUBLIC__/js/common.js"></script>
	<script>
		function refersh_window() {
			var refersh_time = getCookie('refersh_time');
			if (refersh_time == 1) {
				window.location = "{:U('News/index',$formget)}";
			}
		}
		setInterval(function() {
			refersh_window();
		}, 2000);
		$(function() {
			setCookie("refersh_time", 0);
			Wind.use('ajaxForm', 'artDialog', 'iframeTools', function() {
				//批量复制
				$('.js-articles-copy').click(function(e) {
					var ids=[];
					$("input[name='ids[]']").each(function() {
						if ($(this).is(':checked')) {
							ids.push($(this).val());
						}
					});
					
					if (ids.length == 0) {
						art.dialog.through({
							id : 'error',
							icon : 'error',
							content : '您没有勾选信息，无法进行操作！',
							cancelVal : '关闭',
							cancel : true
						});
						return false;
					}
					
					ids= ids.join(',');
					art.dialog.open("__ROOT__/index.php?g=admin&m=news&a=copy&ids="+ ids, {
						title : "批量复制",
						width : "300px"
					});
				});
				//批量移动
				$('.js-articles-move').click(function(e) {
					var ids=[];
					$("input[name='ids[]']").each(function() {
						if ($(this).is(':checked')) {
							ids.push($(this).val());
						}
					});
					
					if (ids.length == 0) {
						art.dialog.through({
							id : 'error',
							icon : 'error',
							content : '您没有勾选信息，无法进行操作！',
							cancelVal : '关闭',
							cancel : true
						});
						return false;
					}
					
					ids= ids.join(',');
					art.dialog.open("__ROOT__/index.php?g=admin&m=news&a=move&old_term_id={$news.newsid|default=0}&ids="+ ids, {
						title : "批量移动",
						width : "300px"
					});
				});
			});
		});
	</script>
</body>
</html>